#include <iostream>
using namespace std;

int main(){
    //整型
    //1、短整型 （-32768 ～ 32767）———— 占用2字节
    short num1 = 10;
    cout << "num1 = " << num1 << endl;

    short worry = 32900;
    cout << "worry = " << worry << endl; //输出的结果，与所赋值不一致


    //2、整型————占用4字节
    int num2 = 20;
    cout << "num2 = " << num2 << endl;


    //3、长整型————占用8字节
    long num3 = 30;
    cout << "num3 = " << num3 << endl;


    //4、长长整型————占用8字节
    long long num4 = 40;
    cout << "num4 = " << num4 << endl;


    /*
        利用sizeof求出所占内存空间
        语法：sizeof( 数据类型 / 变量 )
    */
    cout << "short占用的字节为：" << sizeof(num1) << endl;// 2
    cout << "int占用的字节为：" << sizeof(int) << endl;// 4
    cout << "long占用的字节为：" << sizeof(long) << endl;// 8
    cout << "long long占用的字节为：" << sizeof(long long) << endl;// 8


    return 0;
}